function userObj() {
    this.userType = 1
    this.userInfo = null
    this.token = ''
    this.version = ''
    this.XPACK_LICENSE_IS_VALID = false
    this.isXPack = false
    this.themeInfo = null
    this.isExpire = () => {
        return this.isXPack && !this.XPACK_LICENSE_IS_VALID
    }

    this.isEnterprise = () => {
        return this.isXPack && this.XPACK_LICENSE_IS_VALID
    }

    this.changeUserType = (num) => {
        this.userType = num
    }

    this.isDefaultTheme = () => {
        return !this.themeInfo?.theme || this.themeInfo?.theme === '#3370FF'
    }

    this.getToken = () => {
        if (this.token) {
            return this.token
        }
        return this.userType === 1 ? localStorage.getItem('token') : this.getAccessToken()
    }
    this.getAccessToken = () => {
        const accessToken = sessionStorage.getItem('accessToken')
        if (accessToken) {
            return accessToken
        }
        return localStorage.getItem('accessToken')
    }
}
export const user = new userObj()

function commonObj() {
    this.device = 'Desktop'
    this.isMobile = () => {
        return this.device === 'Mobile'
    }
}
export const common = new commonObj();